<template>
    <div>
        <el-steps :active="0" simple>
            <el-step title="学生自评申请"></el-step>
            <el-step title="班级审核"></el-step>
            <el-step title="班内公示"></el-step>
            <el-step title="学院复审"></el-step>
            <el-step title="学校核定"></el-step>
        </el-steps>
        <div style="width: 60%;">
            <el-descriptions title="" :column=3 :colon=false style="margin-top:5%">
                <el-descriptions-item label="自评分数：">{{Self_Score}}</el-descriptions-item>
                <el-descriptions-item label="班委评分：">{{Class_com_score}}</el-descriptions-item>
                <el-descriptions-item label="综测班级排名：">{{zc_rank}}</el-descriptions-item>
                <el-descriptions-item label="学业绩点：">{{GPA}}</el-descriptions-item>
                <el-descriptions-item label="绩点排名：">{{GPA_rank}}</el-descriptions-item>
                <el-descriptions-item label="不及格科目数：">{{Failed_Num}}</el-descriptions-item>
                <el-descriptions-item label=''></el-descriptions-item>
            </el-descriptions>
            <div class="right">
                <el-button
                    style="background-color:rgb(64,149,229);position: relative;color: aliceblue; font-size: 16px;"
                    @click="submitData(),submitToClass()">提交</el-button>
            </div>
        </div>

        <!-- 各项分数表格 -->
        <div style="display: flex;flex-direction: column; height: 100%;">
            <!-- 智育分 -->
            <template class="form1" style="flex:1;">
                <div @click="ZyaddData" style="margin-bottom: -23px; width: 120px; height: 40px;top: 3px">
                    <el-button class="add"
                        style="background-color:blue;color: aliceblue; font-size: 16px;width: 120px;height: 100%;">+新增细项
                    </el-button>
                </div>
                <!--新增/编辑界面-->
                <el-dialog :title="titleMap[dialogStatus]" :visible.sync="ZydialogVisiable" :show-close="false">
                    <el-form :model="form" label-width="80px" ref="form">
                        <el-form-item label="细项名称" width="80px">
                            <el-select class="dialog_input1" v-model="form.xxName" placeholder="请选择">
                                <el-option label="智育基础分" value="智育基础分" @click.native="pingU()"></el-option>
                                <el-option label="智育附加分" value="智育附加分" @click.native="pingD()"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="内容说明" width="80px">
                            <el-input class="dialog_input2" v-model="form.contentSm"></el-input>
                        </el-form-item>
                        <div id="zpd" class="pingfenN">
                            <el-form-item label="自评分" width="80px">
                                <el-input class="dialog_input3" v-model="form.zySelfScore"
                                    onkeyup="value=value.replace(/[^\d]/g,'')"
                                    oninput="if(value>100)value=100;if(value<0)value=0"
                                    @blur="selfScoreNotNull($event)" ></el-input>
                            </el-form-item>
                            <el-form-item label="班委评分" width="80px">
                                <el-input class="dialog_input3" v-model="form.zyBwScore"
                                    onkeyup="value=value.replace(/[^\d]/g,'')"
                                    oninput="if(value>100)value=100;if(value<0)value=0"></el-input>
                            </el-form-item>
                        </div>
                        <div id="zpx" class="pingfenN">
                          <el-form-item label="建议评分" width="80px">
                            <el-input class="dialog_input3" v-model="form.sugScore"

                                      oninput="if(value>100)value=100;"></el-input>
                          </el-form-item>
                        </div>
                        <el-form-item label="日期" width="80px">
                            <el-date-picker v-model="form.zyNewTime" type="date" placeholder="选择日期"
                                value-format="yyyy.MM.dd">
                            </el-date-picker>
                        </el-form-item>
                        <el-form-item label="文件">
                            <el-upload :model="ruleForm" status-icon
                                       ref="ruleForm" name="image" class="upload-demo"
                                       action="string"
                                       :auto-upload="false"
                                       list-type="picture-card"
                                       :on-preview="handlePictureCardPreview"
                                       :on-remove="handleRemovePlan"
                                       :file-list="picture"
                                       :on-change="OnChangeOutLookPlan"
                                       accept=".jpg,.jpeg,.png,.gif,.bmp,.JPG,.JPEG,.PBG,.GIF,.BMP">
                                <el-button size="small" type="primary">选择文件</el-button>
                                <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>
                            </el-upload>
                        </el-form-item>

                    </el-form>
                    <div slot="footer" class="dialog-footer">
                        <el-button v-if="addBtnshow" type="primary" @click="Zysubmit(),testPictureUpload(),pingA()">确定
                        </el-button>
                        <el-button v-if="editBtnshow" type="primary" @click.native="ZconfirmEdit('form')">确定
                        </el-button>
                        <el-button @click.native="ZhandleCancel('form'),pingA()">取消</el-button>
                    </div>
                </el-dialog>

                    <h3 style="font-size: 15px;text-align: center;">“智育分”（60%）模块综合评定</h3>
                    <el-table
                        :data="ZyData.slice((paginations.currentPage-1)*paginations.PageSize,paginations.currentPage*paginations.PageSize)"
                        border highlight-current-row v-loading="listLoading" @selection-change="selsChange"
                        style="width: 100%;" :fit=false :stripe=true>
                        <el-table-column prop="index" label="序号" width="50" type="index">
                        </el-table-column>
                        <el-table-column prop="xxName" label="细项名称" width="120">
                        </el-table-column>
                        <el-table-column prop="contentSm" label="内容说明" width="280">
                        </el-table-column>
                        <el-table-column prop="eviMat" label="证明材料" width="180">
                        </el-table-column>
                        <el-table-column prop="sugScore" label="建议评分" width="80">
                        </el-table-column>
                        <el-table-column prop="zySelfScore" label="自评分" width="80">
                        </el-table-column>
                        <el-table-column prop="zyBwScore" label="班委评分" width="80">
                        </el-table-column>
                        <el-table-column prop="zyNewTime" label="更新时间" width="90">
                        </el-table-column>
                        <el-table-column label="操作" width="300">
                            <template slot-scope="scope">
                                <el-button type="text" size="small" @click="ZhandleEdit(scope.$index, scope.row)">编辑
                                </el-button>
                                <el-button size="small" type="text" @click="handleDelete(scope.$index, $event)"
                                    name="zy">删除</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                    <div class="block">
                        <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                            :current-page="paginations.currentPage" :page-sizes="paginations.pageSizes"
                            :page-size="paginations.PageSize" layout="total, sizes, prev, pager, next, jumper"
                            :total="ZyData.length">
                        </el-pagination>
                    </div>


            </template>

            <!-- 德育分 -->
            <template class="form1" style="flex: 1;">
                <div @click="DyaddData" style="margin-bottom: -23px;width: 120px; height: 40px;">
                    <el-button class="add"
                        style="background-color:blue;color: aliceblue; font-size: 16px;width: 120px;height: 100%;">+新增细项
                    </el-button>
                </div>
                <el-dialog :title="titleMap[dialogStatus]" :visible.sync="DydialogVisiable" :show-close="false">
                    <el-form :model="form" label-width="80px" ref="form">
                        <el-form-item label="细项名称" width="80px">
                            <el-select class="dialog_input1" v-model="form.xxName" placeholder="请选择">
                                <el-option label="德育基础分" value="德育基础分"></el-option>
                                <el-option label="德育附加分" value="德育附加分"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="内容说明" width="80px">
                            <el-input class="dialog_input2" v-model="form.contentSm"></el-input>
                        </el-form-item>
                      <div style="display:flex">
                        <el-form-item label="自评分" width="80px">
                          <el-input class="dialog_input3" v-model="form.dySelfScore"
                                    onkeyup="value=value.replace(/[^\d]/g,'')"
                                    oninput="if(value>100)value=100;if(value<0)value=0"
                                    @blur="selfScoreNotNull($event)" ></el-input>
                        </el-form-item>
                        <el-form-item label="班委评分" width="80px">
                          <el-input class="dialog_input3" v-model="form.dyBwScore"
                                    onkeyup="value=value.replace(/[^\d]/g,'')"
                                    oninput="if(value>100)value=100;if(value<0)value=0"></el-input>
                        </el-form-item>
                      </div>
                      <el-form-item label="日期" width="80px">
                        <el-date-picker v-model="form.dyNewTime" type="date" placeholder="选择日期"
                                        value-format="yyyy.MM.dd">
                        </el-date-picker>
                      </el-form-item>
                      <el-form-item label="文件">
                        <el-upload :model="ruleForm" status-icon
                                   ref="ruleForm" name="image" class="upload-demo"
                                   action="string"
                                   :auto-upload="false"
                                   list-type="picture-card"
                                   :on-preview="handlePictureCardPreview"
                                   :on-remove="handleRemovePlan"
                                   :file-list="picture"
                                   :on-change="OnChangeOutLookPlan"
                                   accept=".jpg,.jpeg,.png,.gif,.bmp,.JPG,.JPEG,.PBG,.GIF,.BMP">
                          <el-button size="small" type="primary">选择文件</el-button>
                          <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>
                        </el-upload>
                      </el-form-item>
                    </el-form>
                    <div slot="footer" class="dialog-footer">
                        <el-button v-if="addBtnshow" type="primary" @click="Dysubmit(),testPictureUpload()">确 定</el-button>
                        <el-button v-if="editBtnshow" type="primary" @click.native="DconfirmEdit('form')">确 定</el-button>
                      <el-button @click.native="DhandleCancel('form')">取 消</el-button>
                    </div>
                </el-dialog>
                <h3 style="font-size: 15px;text-align: center;">“德育分”（20%）模块综合评定</h3>
                <el-table
                  :data="DyData.slice((paginations.currentPage-1)*paginations.PageSize,paginations.currentPage*paginations.PageSize)"
                  border highlight-current-row v-loading="listLoading" @selection-change="selsChange"
                  style="width: 100%;" :fit=false :stripe=true>
                    <el-table-column prop="index" label="序号" width="50" type="index">
                    </el-table-column>
                    <el-table-column prop="xxName" label="细项名称" width="120">
                    </el-table-column>
                    <el-table-column prop="contentSm" label="内容说明" width="280">
                    </el-table-column>
                    <el-table-column prop="eviMat" label="证明材料" width="180">
                    </el-table-column>
                    <el-table-column prop="sugScore" label="建议评分" width="80">
                    </el-table-column>
                    <el-table-column prop="dySelfScore" label="自评分" width="80">
                    </el-table-column>
                    <el-table-column prop="dyBwScore" label="班委评分" width="80">
                    </el-table-column>
                    <el-table-column prop="dyNewTime" label="更新时间" width="90">
                    </el-table-column>
                    <el-table-column label="操作" width="300">
                        <template slot-scope="scope">
                            <el-button @click="DhandleEdit(scope.$index,scope.row)" type="text" size="small">编辑</el-button>
                            <el-button @click="handleDelete(scope.$index, $event)" type="text" size="small" name='dy'>删除
                            </el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <div class="block">
                    <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                        :current-page="paginations.currentPage" :page-sizes="paginations.pageSizes"
                        :page-size="paginations.PageSize" layout="total, sizes, prev, pager, next, jumper"
                        :total="DyData.length">
                    </el-pagination>
                </div>
            </template>

            <!-- 体育分 -->
            <template class="form1" style="flex: 1;">
                <div @click="TyaddData" style="margin-bottom: -23px;width: 120px; height: 40px;">
                    <el-button class="add"
                        style="background-color:blue;color: aliceblue; font-size: 16px;width: 120px;height: 100%;">+新增细项</el-button>
                </div>
                <el-dialog style="width: 100%;height: 1000px;" title="增添细项" :visible.sync="TydialogVisiable"
                    :show-close="false">
                    <el-form :model="form">
                        <!-- <el-form-item label="细项名称" width="80px">
                            <el-input class="dialog_input" v-model="form.xxName"></el-input>
                        </el-form-item> -->
                        <el-form-item label="细项名称" width="80px">
                            <el-select class="dialog_input1" v-model="form.xxName" placeholder="请选择">
                                <el-option label="体育基础分" value="体育基础分"></el-option>
                                <el-option label="体育附加分" value="体育附加分"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="内容说明" width="80px">
                            <el-input class="dialog_input2" v-model="form.contentSm"></el-input>
                        </el-form-item>
                        <el-form-item>
                            <el-upload class="upload-demo" action="https://jsonplaceholder.typicode.com/posts/"
                                :before-remove="beforeRemove" multiple>
                                <el-button size="small" type="primary">上传证明材料</el-button>
                                <!-- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div> -->
                            </el-upload>
                        </el-form-item>
                    </el-form>
                    <div slot="footer" class="dialog-footer">
                        <el-button type="primary" @click="Tysubmit">确 定</el-button>
                        <el-button @click="TydialogVisiable = false">取 消</el-button>
                    </div>
                </el-dialog>
                <h3 style="font-size: 15px;text-align: center;">“体育分”（10%）模块综合评定</h3>
                <el-table
                  :data="TyData.slice((paginations.currentPage-1)*paginations.PageSize,paginations.currentPage*paginations.PageSize)"
                  border highlight-current-row v-loading="listLoading" @selection-change="selsChange"
                  style="width: 100%;" :fit=false :stripe=true>
                    <el-table-column prop="index" label="序号" width="50" type="index">
                    </el-table-column>
                    <el-table-column prop="xxName" label="细项名称" width="120">
                    </el-table-column>
                    <el-table-column prop="contentSm" label="内容说明" width="280">
                    </el-table-column>
                    <el-table-column prop="eviMat" label="证明材料" width="180">
                    </el-table-column>
                    <el-table-column prop="sugScore" label="建议评分" width="80">
                    </el-table-column>
                    <el-table-column prop="tySelfScore" label="自评分" width="80">
                    </el-table-column>
                    <el-table-column prop="tyBwScore" label="班委评分" width="80">
                    </el-table-column>
                    <el-table-column prop="tyNewTime" label="更新时间" width="90">
                    </el-table-column>
                    <el-table-column label="操作" width="300">
                        <template slot-scope="scope">
                            <el-button @click="handleClick(scope.row)" type="text" size="small">编辑</el-button>
                            <el-button @click="handleDelete(scope.$index, $event)" type="text" size="small" name='ty'>删除
                            </el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <div class="block">
                    <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                        :current-page="paginations.currentPage" :page-sizes="paginations.pageSizes"
                        :page-size="paginations.PageSize" layout="total, sizes, prev, pager, next, jumper"
                        :total="TyData.length">
                    </el-pagination>
                </div>
            </template>

            <!-- 劳育分 -->
            <template class="form1" style="flex: 1;">
                <div @click="LyaddData" style="margin-bottom: -23px;width: 120px; height: 40px;">
                    <el-button class="add"
                        style="background-color:blue;color: aliceblue; font-size: 16px;width: 120px;height: 100%">+新增细项</el-button>
                </div>
                <el-dialog style="width: 100%;height: 1000px;" title="增添细项" :visible.sync="LydialogVisiable"
                    :show-close="false">
                    <el-form :model="form">
                        <!-- <el-form-item label="细项名称" width="80px">
                            <el-input class="dialog_input" v-model="form.xxName"></el-input>
                        </el-form-item> -->
                        <el-form-item label="细项名称" width="80px">
                            <el-select class="dialog_input1" v-model="form.xxName" placeholder="请选择">
                                <el-option label="劳育基础分" value="劳育基础分"></el-option>
                                <el-option label="劳育附加分" value="劳育附加分"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="内容说明" width="80px">
                            <el-input class="dialog_input2" v-model="form.contentSm"></el-input>
                        </el-form-item>
                        <el-form-item>
                            <el-upload class="upload-demo" action="https://jsonplaceholder.typicode.com/posts/"
                                :before-remove="beforeRemove" multiple>
                                <el-button size="small" type="primary">上传证明材料</el-button>
                                <!-- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div> -->
                            </el-upload>
                        </el-form-item>
                    </el-form>
                    <div slot="footer" class="dialog-footer">
                        <el-button type="primary" @click="Lysubmit">确 定</el-button>
                        <el-button @click="LydialogVisiable = false">取 消</el-button>
                    </div>
                </el-dialog>
                <h3 style="font-size: 15px;text-align: center;">“劳育分”（5%）模块综合评定</h3>
                <el-table
                    :data="LyData.slice((paginations.currentPage-1)*paginations.PageSize,paginations.currentPage*paginations.PageSize)"
                    border v-loading=false style="width:100%" :fit=false>
                    <el-table-column prop="index" label="序号" width="50" type="index">
                    </el-table-column>
                    <el-table-column prop="xxName" label="细项名称" width="120">
                    </el-table-column>
                    <el-table-column prop="contentSm" label="内容说明" width="280">
                    </el-table-column>
                    <el-table-column prop="eviMat" label="证明材料" width="180">
                    </el-table-column>
                    <el-table-column prop="sugScore" label="建议评分" width="80">
                    </el-table-column>
                    <el-table-column prop="lySelfScore" label="自评分" width="80">
                    </el-table-column>
                    <el-table-column prop="lyBwScore" label="班委评分" width="80">
                    </el-table-column>
                    <el-table-column prop="lyNewTime" label="更新时间" width="90">
                    </el-table-column>
                    <el-table-column label="操作" width="300">
                        <template slot-scope="scope">
                            <el-button @click="handleClick(scope.row)" type="text" size="small">编辑</el-button>
                            <el-button @click="handleDelete(scope.$index, $event)" type="text" size="small" name='ly'>删除
                            </el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <div class="block">
                    <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                        :current-page="paginations.currentPage" :page-sizes="paginations.pageSizes"
                        :page-size="paginations.PageSize" layout="total, sizes, prev, pager, next, jumper"
                        :total="LyData.length">
                    </el-pagination>
                </div>
            </template>

            <!-- 美育分 -->
            <template class="form1" style="flex: 1;">
                <div @click="MyaddData" style="margin-bottom: -23px;width: 120px; height: 40px;">
                    <el-button class="add"
                        style="background-color:blue;color: aliceblue; font-size: 16px;width: 120px;height: 100%;">+新增细项</el-button>
                </div>
                <el-dialog style="width: 100%;height: 1000px;" title="增添细项" :visible.sync="MydialogVisiable"
                    :show-close="false">
                    <el-form :model="form">
                        <!-- <el-form-item label="细项名称" width="80px">
                            <el-input class="dialog_input" v-model="form.xxName"></el-input>
                        </el-form-item> -->
                        <el-form-item label="细项名称" width="80px">
                            <el-select class="dialog_input1" v-model="form.xxName" placeholder="请选择">
                                <el-option label="美育基础分" value="美育基础分"></el-option>
                                <el-option label="美育附加分" value="美育附加分"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="内容说明" width="80px">
                            <el-input class="dialog_input2" v-model="form.contentSm"></el-input>
                        </el-form-item>
                        <el-form-item>
                            <el-upload class="upload-demo" action="https://jsonplaceholder.typicode.com/posts/"
                                :before-remove="beforeRemove" multiple>
                                <el-button size="small" type="primary">上传证明材料</el-button>
                                <!-- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div> -->
                            </el-upload>
                        </el-form-item>
                    </el-form>
                    <div slot="footer" class="dialog-footer">
                        <el-button type="primary" @click="Mysubmit">确 定</el-button>
                        <el-button @click="MydialogVisiable = false">取 消</el-button>
                    </div>
                </el-dialog>
                <h3 style="font-size: 15px;text-align: center;">“美育分”（5%）模块综合评定</h3>
                <el-table
                    :data="MyData.slice((paginations.currentPage-1)*paginations.PageSize,paginations.currentPage*paginations.PageSize)"
                    border v-loading=false style="width:100%" :fit=false>
                    <el-table-column prop="index" label="序号" width="50" type="index">
                    </el-table-column>
                    <el-table-column prop="xxName" label="细项名称" width="120">
                    </el-table-column>
                    <el-table-column prop="contentSm" label="内容说明" width="280">
                    </el-table-column>
                    <el-table-column prop="eviMat" label="证明材料" width="180">
                    </el-table-column>
                    <el-table-column prop="sugScore" label="建议评分" width="80">
                    </el-table-column>
                    <el-table-column prop="mySelfScore" label="自评分" width="80">
                    </el-table-column>
                    <el-table-column prop="myBwScore" label="班委评分" width="80">
                    </el-table-column>
                    <el-table-column prop="myNewTime" label="更新时间" width="90">
                    </el-table-column>
                    <el-table-column label="操作" width="300">
                        <template slot-scope="scope">
                            <el-button @click="handleClick(scope.row)" type="text" size="small">编辑</el-button>
                            <el-button @click="handleDelete(scope.$index, $event)" type="text" size="small" name='my'>删除
                            </el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <div class="block">
                    <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                        :current-page="paginations.currentPage" :page-sizes="paginations.pageSizes"
                        :page-size="paginations.PageSize" layout="total, sizes, prev, pager, next, jumper"
                        :total="MyData.length">
                    </el-pagination>
                </div>
            </template>
        </div>
    </div>

</template>

<script>
import axios from 'axios'

var _index
var maxZIndex;
var maxDIndex;
var maxTIndex;
var maxLIndex;
var maxMIndex;

export default {
    name: 'Self_of_s',
    data() {
        return {
          labelPosition: 'left',
          // 图片上传相关
          dialogVisible: true,
          dialogImageUrl: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fa4.att.hudong.com%2F27%2F67%2F01300000921826141299672233506.jpg&refer=http%3A%2F%2Fa4.att.hudong.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1614780040&t=335e293322bac198f2af7379a03a52f6',
          planBool:false,
          picture: [],
          ruleForm: {
            name: '',
            deviceType: '',
            natureOfPoint: '',
            project: '',
            progress: '',
            location: ''
          },
          param: new FormData(), // 上传数据用这个

          maxZIndex,
            maxDIndex,
            maxLIndex,
            maxMIndex,
            maxTIndex,
            pch: '',
            usernum: window.sessionStorage.getItem("stuNum"),
            Self_Score: 100,
            Class_com_score: 80,
            zc_rank: 3,
            GPA: 3.5,
            GPA_rank: 3,
            Failed_Num: 0,
            stripe: true,
            dialogVisiable: false,
            fileList:[],
            loading: true,
            FormVisible: false,
            currentRow: [],
            ids: [],
            listLoading: '',
            addBtnshow: false,
            editBtnshow: false,
            editLoading: '',
            dialogStatus: '',
            selected: [],
            editid: '',
            searchForm: [],
            pickerOptions: {
                disabledDate(time) {
                    return time.getTime() > Date.now();
                }
            },
            form: {
                stuNum:this.$store.state.com_data.userNum,
                classNum: this.$store.state.com_data.classNum,
                xxName: '',
                sugScore:'',
                contentSm: 0,
                zySelfScore: '',
                zyBwScore: '',
                zyNewTime: '',
            },
            ZyData: [{
              stuNum:this.$store.state.com_data.userNum,
              classNum: this.$store.state.com_data.classNum,
                xxName: '智育基本分',
                contentSm: '学习成绩',
                eviMat: '查看附件',
                sugScore: 1,
                zySelfScore: 90,
                zyBwScore: 100,
                zyNewTime: '2021.10.10'
            }
            ],
            DyData: [{
                stuNum:this.$store.state.com_data.userNum,
                classNum: this.$store.state.com_data.classNum,
                xxName: '德育基本分',
                contentSm: '学习成绩',
                eviMat: '查看附件',
                sugScore: -4,
                dySelfScore: 100,
                dyBwScore: 100,
                dyNewTime: '2021.10.10'
            }
            ],
            TyData: [{
              stuNum:this.$store.state.com_data.userNum,
              classNum: this.$store.state.com_data.classNum,
                xxName: '体育基本分',
                contentSm: '学习成绩',
                eviMat: '查看附件',
                sugScore: 4,
                tySelfScore: 100,
                tyBwScore: 100,
                tyNewTime: '2021.10.10'
            }
            ],
            MyData: [{
              stuNum:this.$store.state.com_data.userNum,
              classNum: this.$store.state.com_data.classNum,
                xxName: '美育基本分',
                contentSm: '学习成绩',
                eviMat: '查看附件',
                sugScore: 4,
                mySelfScore: 100,
                myBwScore: 100,
                myNewTime: '2021.10.10'
            }
            ],
            LyData: [{
              stuNum:this.$store.state.com_data.userNum,
              classNum: this.$store.state.com_data.classNum,
                xxName: '劳育基本分',
                contentSm: '学习成绩',
                eviMat: '查看附件',
                sugScore: 4,
                lySelfScore: 100,
                lyBwScore: 100,
                lyNewTime: '2021.10.10'
            }
            ],
            titleMap: {
                addEquipment: '新增细项',
                editEquipment: '编辑细项'
            },
            ZydialogVisiable: false,
            DydialogVisiable: false,
            TydialogVisiable: false,
            LydialogVisiable: false,
            MydialogVisiable: false,
            paginations: {
                // 默认显示第几页
                currentPage: 1,
                // 个数选择器（可修改）
                pageSizes: [1, 2, 3, 4],
                // 默认每页显示的条数（可修改）
                PageSize: 4,
            },
        }
    },
    methods: {
      //获取当前时间
      getNowTime(){
        let time = new Date()
        var s=time.toLocaleDateString()
        console.log(s)
        return s
      },
      //获取当前最大index
      getMaxIndex(){
        maxZIndex=this.ZyData.length;
        maxDIndex=this.DyData.length;
        maxTIndex=this.TyData.length;
        maxLIndex=this.LyData.length;
        maxMIndex=this.MyData.length;
        // console.log(maxZIndex);
      },
      /* // 文件上传 - 上传前
      beforeUpload(file, fileList) {
        this.uploadData = { tradeOrder: index }; //上传携带的参数名
        let promise = new Promise((resolve) => {
          this.$nextTick(function () {
            resolve(true);
          });
        });
        return promise;
      },
      // 文件上传 - 文件选中后上传
      handlePictureCardPreview2(file, fileList) {
        this.$refs.uploadComp.submit();
      }, */

      pingU(){
        document.getElementById("zpd").className="pingfenY"
        document.getElementById("zpx").className="pingfenN"
      },
      pingD(){
        document.getElementById("zpd").className="pingfenN"
        document.getElementById("zpx").className="pingfenY"
      },
      pingA(){
        document.getElementById("zpd").className="pingfenN"
        document.getElementById("zpx").className="pingfenN"
      },

      OnChangeOutLookPlan(file, fileList) {
        console.log(fileList)
        this.picture = []
        this.picture.push(file)
      },
      handleRemovePlan() {
        this.planBool = true
        this.picture = []
      },
      handlePictureCardPreview(file) {
        this.dialogImageUrl = file.url;
        this.dialogVisible = true;
      },
// 测试图片上传
      testPictureUpload() {
        // 设置数据， 后台用这个接收 @RequestParam("txt") String txt
        // this.param.set("txt",'66666')
        for (var i = 0; i < this.picture.length; i++) {

          this.param.set('picture', this.picture[i].raw);
        }
        this.param.set('maxZIndex','Zy'+(maxZIndex+1));
        this.param.set('userNum', this.$store.state.com_data.userNum);
        var arr = []
        this.param.forEach(function (value) {
          arr.push(value)
        });
        var lastArr = arr
        var data = this.param
        console.log(lastArr)
        this.$axios({
          method: "POST",
          url: "http://localhost:/img/upload",
          data:data,
          headers: {
            // token: this.token,
            'Content-Type': 'multipart/form-data' // 传递图片 headers 里得这样写
          }
        }).then(res =>{
          console.log(res)
          this.showMsg(res);
        })
      },




      beforeUpload (file) {
        // console.log(file)
        // let fd = new FormData()
        // fd.append('image', file.name)
        // fd.append('maxZIndex', this.maxZIndex)
        // fd.append('userNum', this.$store.state.com_data.userNum)
        console.log(file.name)
        console.log(file)
          // console.log(res)
          this.$axios.post(`http://localhost:/img/upload/${maxZIndex+1}&${window.sessionStorage.getItem("stuNum")}`).then(res => {
            console.log(res.data)
          })
        return true
      },
      newSubmitForm () {
        this.$refs.newupload.submit()
      },

        handleClick(row) {
            console.log(row)
        },

        // 每页显示多少条
        handleSizeChange(val) {
            // 改变每页显示的条数
            this.paginations.PageSize = val
            // 注意：在改变每页显示的条数时，要将页码显示到第一页
            this.paginations.currentPage = 1
            console.log(`每页 ${val} 条`);
        },
        // 现在显示当前页的第几页
        handleCurrentChange(val) {
            // 改变默认的页数
            this.paginations.currentPage = val
            console.log(`当前页: ${val}`);
        },

        // 智育新增数据
        ZyaddData() {
            this.form = {
              stuNum:window.sessionStorage.getItem("stuNum"),
              classNum: window.sessionStorage.getItem("classNum"),
                id:'null',
                xxName: '',
                contentSm: '',
                eviMat: '查看附件',
                sugScore: 0,
                zySelfScore: 0,
                zyBwScore: 0,
                zyNewTime: '2021.10.10'
            }
            this.dialogStatus = "addEquipment"
            this.ZydialogVisiable = true
            this.addBtnshow = true
            this.editBtnshow=false
          // console.log(this.$store.state.com_data.address);
        },
        Zysubmit() {
            // this.form.date = reformat(this.form.date); //日期类型转换
            this.ZyData.push(this.form) //向ZyData中添加数据
            this.ZydialogVisiable = false   //自定义对话框隐藏
            this.addBtnshow = false
        },

        // 德育新增数据
        DyaddData() {
            this.form = {
              stuNum:window.sessionStorage.getItem("stuNum"),
              classNum: window.sessionStorage.getItem("classNum"),
              id:'null',
                xxName: '',
                contentSm: '',
                eviMat: '查看附件',
                sugScore: 0,
                dySelfScore: 0,
                dyBwScore: 0,
                dyNewTime: '2021.10.10'
            }
            this.dialogStatus="addEquipment"
            this.DydialogVisiable = true
            this.addBtnshow=true
            this.editBtnshow=false
        },
        Dysubmit() {
            // this.form.date = reformat(this.form.date); //日期类型转换
            this.DyData.push(this.form) //向DyData中添加数据
            this.DydialogVisiable = false   //自定义对话框隐藏
        },

        //劳育新增数据
        LyaddData() {
            this.form = {
              stuNum:window.sessionStorage.getItem("stuNum"),
              classNum: window.sessionStorage.getItem("classNum"),
              id:'null',
                xxName: '',
                contentSm: '',
                eviMat: '查看附件',
                sugScore: 0,
                lySelfScore: 0,
                lyBwScore: 0,
                lyNewTime: '2021.10.10'
            }
            this.LydialogVisiable = true
        },
        Lysubmit() {
            // this.form.date = reformat(this.form.date); //日期类型转换
            this.LyData.push(this.form) //向LyData中添加数据
            this.LydialogVisiable = false   //自定义对话框隐藏
        },

        // 美育新增数据
        MyaddData() {
            this.form = {
              stuNum:window.sessionStorage.getItem("stuNum"),
              classNum: window.sessionStorage.getItem("classNum"),
              id:'null',
                xxName: '',
                contentSm: '',
                eviMat: '查看附件',
                sugScore: 0,
                mySelfScore: 0,
                myBwScore: 0,
                myNewTime: '2021.10.10'
            }
            this.MydialogVisiable = true
        },
        Mysubmit() {
            // this.form.date = reformat(this.form.date); //日期类型转换
            this.MyData.push(this.form) //向MyData中添加数据
            this.MydialogVisiable = false   //自定义对话框隐藏
        },

        TyaddData() {
            this.form = {
              stuNum:window.sessionStorage.getItem("stuNum"),
              classNum: window.sessionStorage.getItem("classNum"),
                id:'null',
                xxName: '',
                contentSm: '',
                eviMat: '查看附件',
                sugScore: 0,
                tySelfScore: 0,
                tyBwScore: 0,
                tyNewTime: '2021.10.10'
            }
            this.TydialogVisiable = true
        },
        Tysubmit() {
            // this.form.date = reformat(this.form.date); //日期类型转换
            this.TyData.push(this.form) //向TyData中添加数据
            this.TydialogVisiable = false   //自定义对话框隐藏
        },

        beforeRemove(file, fileList) {
            return this.$confirm(`确定移除 ${file.name}?`);
        },
        submitData() {
          // console.log({ZyData: this.ZyData, DyData: this.DyData, TyData: this.TyData, LyData: this.LyData, MyData: this.MyData})
            this.$axios.post('http://localhost:/self/add', { ZyData: this.ZyData, DyData: this.DyData, TyData: this.TyData, LyData: this.LyData, MyData: this.MyData }, {
            }).then(res => {
                // console.log(res);

            })
        },
      submitToClass() {
        this.$axios.post('http://localhost:/class/add', { classNum: window.sessionStorage.getItem("classNum"), stuNum: window.sessionStorage.getItem("stuNum"), name: window.sessionStorage.getItem("name"), content: '2022-2023综合测评', newTime: this.getNowTime(),status:'审核中' ,person:window.sessionStorage.getItem("stuNum"),date:this.getNowTime().replaceAll('/','.')}, {
        }).then(res => {
          console.log(res);

        })
      },
        selsChange: function (val) {  //点击选中
            console.log(val);
            this.selected = val;
        },
        // 点击新增
        addRow(ZyData, event) {
            this.FormVisible = false;
            this.form = {
              stuNum:window.sessionStorage.getItem("stuNum"),
              classNum: window.sessionStorage.getItem("classNum"),
                xxName: '',
                contentSm: '',
                zySelfScore: '',
                zyBwScore: '',
                zyNewTime: '',
            };
            this.dialogStatus = "addEquipment"
            this.editBtnshow = false
            this.addBtnshow = true

        },
        // 点击确定（新增）
        confirmAdd() {
            this.ZyData.push({
                xxName: this.form.xxName,
                contentSm: this.form.contentSm,
                zySelfScore: this.form.zySelfScore,
                zyBwScore: this.form.zyBwScore,
                zyNewTime: this.form.zyNewTime
            })
            // storage.set('ZyData', this.ZyData);
            this.ZydialogVisiable = false;
        },
        //点击编辑
        ZhandleEdit: function (index, row) {
            this.ZydialogVisiable = true;
            this.form = Object.assign({}, row); //这句是关键！！！
            _index = index;
            console.log(index);
            console.log(_index);

            this.dialogStatus = "editEquipment"
            this.addBtnshow = false
            this.editBtnshow = true
        },
        DhandleEdit: function (index, row) {
          this.DydialogVisiable = true;
          this.form = Object.assign({}, row); //这句是关键！！！
          _index = index;
          console.log(index);
          console.log(_index);

        this.dialogStatus = "editEquipment"
        this.addBtnshow = false
        this.editBtnshow = true
      },
        // 点击确定（编辑）
        ZconfirmEdit() {
            var editdata = _index;
            console.log(editdata);
            this.ZyData[editdata].xxName = this.form.xxName;
            this.ZyData[editdata].contentSm = this.form.contentSm;
            this.ZyData[editdata].zySelfScore = this.form.zySelfScore;
            this.ZyData[editdata].zyBwScore = this.form.zyBwScore;
            this.ZyData[editdata].sugScore=this.form.sugScore;
            this.ZyData[editdata].zyNewTime = this.form.zyNewTime;
            this.ZydialogVisiable = false;
        },
        DconfirmEdit() {
        var editdata = _index;
        console.log(editdata);
        this.DyData[editdata].xxName = this.form.xxName;
        this.DyData[editdata].contentSm = this.form.contentSm;
        this.DyData[editdata].zySelfScore = this.form.zySelfScore;
        this.DyData[editdata].zyBwScore = this.form.zyBwScore;
        this.DyData[editdata].zyNewTime = this.form.zyNewTime;
        this.DydialogVisiable = false;
      },
        //点击关闭dialog
        handleClose(done) {
            this.FormVisible = false;
        },
        //点击取消
        ZhandleCancel(formName) {
            this.ZydialogVisiable = false;
        },
        DhandleCancel(formName) {
          this.DydialogVisiable = false;
        },
        // 删除
        handleDelete(indexx, e) {
            switch (e.currentTarget.getAttributeNode('name').value) {
                case 'zy':
                    this.ZyData.splice(indexx, 1)
                    break
                case 'dy':
                    this.DyData.splice(indexx, 1)
                    break
                case 'ty':
                    this.TyData.splice(indexx, 1)
                    break
                case 'ly':
                    this.LyData.splice(indexx, 1)
                    break
                case 'my':
                    this.MyData.splice(indexx, 1)
                    break
            }
        },
        // 检验自评分不能为空
        selfScoreNotNull(e){
            print(e)
            if(e.target.value === ''){
                e.target.placeholder = "自评分不能为空"
            }
        },
        // 上传文件按钮的方法
        handleRemove(file, fileList) {
            console.log(file, fileList);
        },
        handlePreview(file) {
            console.log(file);
        },
        handleExceed(files, fileList) {
            this.$message.warning(`当前限制选择 3 个文件，本次选择了 ${files.length} 个文件，共选择了 ${files.length + fileList.length} 个文件`);
        },
      async beOnload(){
        await this.$axios.get(`http://localhost:/self/selectZyData/${window.sessionStorage.getItem("stuNum")}` ).then(res => {
          if (res.status === 200) {
            // console.log(res.data)
            this.ZyData = res.data
          }
          else{
            return '请求失败'
          }
        })
        await this.$axios.get(`http://localhost:/self/selectDyData/${window.sessionStorage.getItem("stuNum")}`).then(res => {
          if (res.status === 200) {
            this.DyData = res.data
          }
          else{
            return '请求失败'
          }
        })
        await this.$axios.get(`http://localhost:/self/selectMyData/${window.sessionStorage.getItem("stuNum")}`).then(res => {
          if (res.status === 200) {
            this.MyData = res.data
          }
          else{
            return '请求失败'
          }
        })
        await this.$axios.get(`http://localhost:/self/selectLyData/${window.sessionStorage.getItem("stuNum")}`).then(res => {
          if (res.status === 200) {
            this.LyData = res.data
          }
          else{
            return '请求失败'
          }
        })
        await this.$axios.get(`http://localhost:/self/selectTyData/${window.sessionStorage.getItem("stuNum")}`).then(res => {
          if (res.status === 200) {
            this.TyData = res.data
          }
          else{
            return '请求失败'
          }
        })
        //获取最大下标
        this.getMaxIndex();
      }
    },
    // 页面一开启就获取数据渲染页面
    mounted() {
        //token
        // this.getLocalStorage();

        this.beOnload();
    }

}

</script>
         <!-- methods:{
            // getdata(){
            //     this.$axios.get('http://127.0.0.1/api/get').then(res=>{
            //         this.sdata = res.data
            //     })
            // },
            // postData(){
            //     this.$axios.post('http://127.0.0.1/api/post',{
            //     }).then(res=>{
            //         console.log(res);
            //     })

            // } -->

<style lang="less" scoped>

.pingfenY{
  display: flex;
}
.pingfenN{
  display: none;
}

.left {
    float: left;
    /* margin-top: 40px; */
}

.right {
    position: absolute;
    top: 6.5%;
    right: -66%;
    font-family: “Microsoft YaHei”;
}

.shenhe {
    width: 180px;
    height: 50px;
    font-size: 14px;
    /* background-color: rgb(243, 234, 234); */
    text-align: center;
    line-height: 50px;
    margin-bottom: 4px;
    border: 2px solid #ccc;
    /* box-shadow: 5px 5px 5px #ccc; */
}

.form1 {
    width: 100%;

}

.dialog_input2 {
    width: 31%;
}

.select_first {
    width: 150px;
    height: 30px;
    border: 1px solid #ccc;
    outline: medium
}

.rank {
    display: inline-block;
    padding: 4px;
    font-size: 14px;
    background-color: skyblue;
}

.add {
    /* position: absolute; */
    /* width: 10%; */
    height: 3.5%;
    margin-bottom: -45px;
    /* text-align: center; */
    /* font-size: 14px; */
    /* line-height: 40px; */
    /* margin-bottom: 4px; */
    /* border: 2px solid #ccc; */
    /* position: absolute;background-color:blue;color: aliceblue; font-size: 16px; margin-bottom: -40px; */
}
</style>


